package com.zff.rental.repository.apartment;

import com.zff.rental.entity.apartment.ApartmentEntity;
import org.jetbrains.annotations.NotNull;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author HCY
 */
@Repository
public interface ApartmentRepository extends JpaRepository<ApartmentEntity, Long>, JpaSpecificationExecutor<ApartmentEntity> {
    boolean existsByName(String name);

    @Override
    @Query("UPDATE ApartmentEntity SET del = :id WHERE id = :id")
    void deleteById(@NotNull Long id);
}
